<?php
$event_id = Yii :: app()->request->getParam('event_id');
$model2 = EventEmailTemplate :: model();
if (!$event_id > 0) {
	$event_id = $model->event_id;
}
?>

<a id="lingjiangdx" href="<?php echo Yii::app()->request->baseUrl; ?>/eventAwardSms/create?event_id=<?php echo $event_id;?>"><?php echo Yii::t('EventAwardSms','Receive SMS')?></a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?php echo Yii::app()->request->baseUrl; ?>/eventEmailTemplate/create?event_id=<?php echo $event_id;?>"><?php echo Yii::t('EventEmailTemplate','Email Templates')?></a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?php echo Yii::app()->request->baseUrl; ?>/eventStep/create?event_id=<?php echo $event_id;?>"><?php echo Yii::t('EventStep','Step')?></a>

<?php

$this->widget('application.extensions.zgrid.ZGridView', array (
	'id' => 'event-email-template-grid',
	'dataProvider' => $model2->search2($event_id),
	'itemsCssClass' => 'responsive table table-striped table-bordered',
	'pager' => array (
		'class' => 'CLinkPager',
		'hiddenPageCssClass' => '',
		'firstPageCssClass' => 'first paginate_button',
		'firstPageLabel' => 'First',
		'prevPageLabel' => 'Previous',
		'nextPageLabel' => 'Next',
		'lastPageLabel' => 'Last',
		'htmlOptions' => array (
			'class' => 'dataTables_paginate paging_full_numbers"'
		),
		'header' => ""
	),
	'pagerCssClass' => 'pagination',
	'cssFile' => false,
	'template' => '{items}{summary}{pager}',
	'summaryText' => 'Default Pagination',
	//'filter'=>$model,

	'columns' => array (
		//array('name'=>'email_id','headerHtmlOptions'=>array('style'=>'width:10%')),
		array (
			'name' => 'event_id',
			'headerHtmlOptions' => array (
				'style' => 'width:10%'
			),
			'value' => 'Event::model()->getEventTitle($data->event_id)'
		),
		array (
			'name' => 'email_title',
			'headerHtmlOptions' => array (
				'style' => 'width:10%'
			)
		),
//		array (
//			'name' => 'message_en',
//			'headerHtmlOptions' => array (
//				'style' => 'width:10%'
//			)
//		),
//		array (
//			'name' => 'message_cn',
//			'headerHtmlOptions' => array (
//				'style' => 'width:10%'
//			)
//		),
		/*
		array('name'=>'is_delete','headerHtmlOptions'=>array('style'=>'width:10%')),
		array('name'=>'remark','headerHtmlOptions'=>array('style'=>'width:10%')),
		array('name'=>'create_time','headerHtmlOptions'=>array('style'=>'width:10%')),
		array('name'=>'create_user','headerHtmlOptions'=>array('style'=>'width:10%')),
		array('name'=>'update_time','headerHtmlOptions'=>array('style'=>'width:10%')),
		array('name'=>'update_user','headerHtmlOptions'=>array('style'=>'width:10%')),
		array('name'=>'is_award','headerHtmlOptions'=>array('style'=>'width:10%')),
		*/
		array (
			'class' => 'CButtonColumn',
			'header' => Yii :: t('common', 'Operater'),
			'template' => '{view} {update} {delete}',
			'headerHtmlOptions' => array (
				'style' => 'width:10%'
			),
			'buttons' => array (
				'update' => array (
					'label' => '<i class="gicon-edit"></i>',
					'imageUrl' => 0,
					'options' => array (
						'class' => 'btn btn-small',
						'rel' => 'tooltip',
						'data-placement' => 'left',
						'title' => Yii :: t('common', 'Update')
					),
					
				),
				'view' => array (
					'label' => '<i class="gicon-eye-open"></i>',
					'imageUrl' => 0,
					'options' => array (
						'class' => 'btn btn-small',
						'rel' => 'tooltip',
						'data-placement' => 'left',
						'title' => Yii :: t('common', 'View')
					),
					
				),
				'delete' => array (
					'label' => '<i class="gicon-remove icon-white"></i>',
					'imageUrl' => 0,
					'options' => array (
						'class' => 'btn btn-inverse btn-small',
						'rel' => 'tooltip',
						'data-placement' => 'left',
						'title' => Yii :: t('common', 'Delete')
					),
					
				),
				
			),
			
		),
		
	),
	
));
?>
<div id="update_form">
<!-- form start -->

<div class="zyWell">Fields with<span class="required">*</span>are required.</div>

<?php

$form = $this->beginWidget('CActiveForm', array (
	'id' => 'event-email-template-form',
	'enableAjaxValidation' => false,
	
));
?>
<?php echo $form->errorSummary($model); ?>
<?php echo $form->hiddenField($model,'event_id',array('size'=>60,'maxlength'=>255,'value'=>$event_id)); ?>
	<div class="row-fluid">
		<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'email_title'); ?>
					<div class="controls span7">
						<?php echo $form->textField($model,'email_title',array('size'=>60,'maxlength'=>255)); ?>
						<?php echo $form->error($model,'email_title'); ?>
					</div>
			</div>
		</div>
	</div>
	<div class="row-fluid">

				<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'message_cn'); ?>
					<div class="controls span7">
						<?php echo $form->textArea($model,'message_cn',array('size'=>60,'class'=>'autogrow','style'=>'overflow-x:auto;overflow-y:auto;width: 750px; height: 500px;')); ?>
						<?php echo $form->error($model,'message_cn'); ?>
					</div>
			</div>
		</div>	
	</div>
		<div class="row-fluid">					
		<div style="margin-left:170px;">
						<input type="button" name="cn_lastName" value="<?php echo Yii::t('event','LastName')?>" id="cn_lastName"/>
						<input type="button" name="cn_firstName" value="<?php echo Yii::t('event','FirstName')?>" id="cn_firstName"/>
						<input type="button" name="cn_url" value="<?php echo Yii::t('event','Url')?>" id="cn_url"/>
					</div>	
		</div>
		
			<div class="row-fluid">

				<div class="span6">
			<div class="form-row control-group row-fluid">
				<?php echo $form->labelEx($model,'message_en'); ?>
					<div class="controls span7">
						<?php echo $form->textArea($model,'message_en',array('size'=>60,'class'=>'autogrow','style'=>'overflow-x:auto;overflow-y:auto;width: 750px; height: 500px;')); ?>
						<?php echo $form->error($model,'message_en'); ?>
					</div>
			</div>
		</div>	
	</div>
		<div class="row-fluid">					
		<div style="margin-left:170px;">
						<input type="button" name="en_lastName" value="<?php echo Yii::t('event','LastName')?>" id="en_lastName"/>
						<input type="button" name="en_firstName" value="<?php echo Yii::t('event','FirstName')?>" id="en_firstName"/>
						<input type="button" name="en_url" value="<?php echo Yii::t('event','Url')?>" id="en_url"/>
					</div>	
		</div>
<div class="form-actions row-fluid">
	<div class="span7 offset3">
		<?php echo CHtml::submitButton($model->isNewRecord ? Yii::t("common","Create") : Yii::t("common","Save"),array('class'=>'btn btn-large btn-block')); ?>
	</div>
</div>
<?php $this->endWidget(); ?>
</div>
<!-- form -->
<?php

Yii :: app()->clientScript->registerScript('search', "
		$('#en_lastName').click(function(){
        $('#EventEmailTemplate_message_en').insertAtCaret('{lastName}');   
   		 }); 
   		 $('#en_firstName').click(function(){
        $('#EventEmailTemplate_message_en').insertAtCaret('{firstName}');   
   		 });
   		  $('#en_url').click(function(){
        $('#EventEmailTemplate_message_en').insertAtCaret('{url}');   
   		 });
   		 		
   		 $('#cn_lastName').click(function(){
        $('#EventEmailTemplate_message_cn').insertAtCaret('{lastName}');   
   		 }); 
   		 $('#cn_firstName').click(function(){
        $('#EventEmailTemplate_message_cn').insertAtCaret('{firstName}');   
   		 });
   		 $('#cn_url').click(function(){
        $('#EventEmailTemplate_message_cn').insertAtCaret('{url}');   
   		 });		
		");
?>